package com.day13.Simple;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.text.ParseException;
public class SimpleDateFormatDemo {
    public static void main(String[] args) throws ParseException {
        Date d = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String s = sdf.format(d);
        System.out.println(s);
        System.out.println("------");
        String ss = "2020-01-01 12:12:12";
        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date d2 = sdf2.parse(ss);
        System.out.println(d2);
    }
}
